<template>
    <div>
 <!-- 面包屑导航区域 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>角色列表</el-breadcrumb-item>
    </el-breadcrumb>

<el-row>
        <el-col>
          <el-button type="primary">添加分类</el-button>
        </el-col>
      </el-row>

    <el-table :data="orderlist" border  stripe >
         <el-table-column type="index"></el-table-column>
      <el-table-column label="分类名称" prop="cat_name"></el-table-column>
       <el-table-column label="是否有效"></el-table-column>
       <el-table-column label="排序">
            <template slot-scope="scope">
            <el-tag v-if="scope.row.cat_level == '0'">一</el-tag>
            <el-tag type="warning" v-else-if="scope.row.cat_level =='1'">二</el-tag>
            <el-tag type="danger" v-else>三</el-tag>
          </template>
       </el-table-column>
       <el-table-column label="操作">
           <template slot-scope="">
            <el-button size="mini" type="primary" icon="el-icon-edit">编辑</el-button>
            <el-button size="mini" type="danger" icon="el-icon-delete">删除</el-button>
           
          </template>
        </el-table-column>
           
    </el-table>
    </div>
</template>
<script>
export default {
   data(){
       return {
         orderlist:[]
       }
   },
   
  created() {
    
    this.getOrderList()   
},
 methods:{
      async getOrderList() {
           const { data: res } = await this.$http.get('categories')
             if (res.meta.status !== 200) {
        return this.$message.error('获取商品列表失败！')
      }

      this.orderlist = res.data

      console.log(this.orderlist)
      }
 }
}
</script>
<style lang="less" scoped>

</style>